/**
 * 六合彩的逻辑
 */
(function() {
    var currTabId = 1;
    var tabDraws = [
        fillTeMa,
        fillLM,
        fillZhengMa,
        fillZhengMa16,
        fill_zengte,
        fill_lianma,
        fillSeBo,
        fillTouWeiShu,
        fillZongXiao,
        fillYiXiao,
        fillTeXiao,
        fill_lianxiao,
        fill_hexiao,
        fill_lianwei,
        fillZhengXiao,
        fillWuXing,
        fill_buzhong,
    ];

    function fillTeMa() {
        // 特码49个号码
        var div = $(".temaa1");
        div.empty();
        for (var i = 1; i <= 45; i++) {
            var k = i < 10 ? "0" + i : i;
            add_bet_item('特码' + k, draw_number(i), div);
        }
        var div = $(".temaa2");
        for (var i = 46; i <= 49; i++) {
            var k = i < 10 ? "0" + i : i;
            add_bet_item('特码' + k, draw_number(i), div);
        }

        var div = $(".temab1");
        div.empty();
        for (var i = 1; i <= 45; i++) {
            var k = i < 10 ? "0" + i : i;
            add_bet_item('特码B' + k, draw_number(i), div);
        }
        var div = $(".temab2");
        for (var i = 46; i <= 49; i++) {
            var k = i < 10 ? "0" + i : i;
            add_bet_item('特码B' + k, draw_number(i), div);
        }

        var types = ["大", "小", "单", "双"];
        var div = $(".lianmian1");
        for (var i in types) {
            add_bet_item('特' + types[i], types[i], div);
        }

        var div = $(".lianmian2");
        add_bet_item('特红', '红波', div);
        add_bet_item('特蓝', '蓝波', div);
        add_bet_item('特绿', '绿波', div);

        // 特码A-B的切换
        var tef = function() {
            $(".temab").show();
            $(".temaa").hide();
            $(".tema-title .teb").attr("class", "active teb");
            $(".tema-title .tea").attr("class", "tea");
        };
        tef();
        $(".tema-title .teb").click(function() {
            tef();
        });
        $(".tema-title .tea").click(function() {
            $(".temaa").show();
            $(".temab").hide();
            $(".tema-title .tea").attr("class", "active tea");
            $(".tema-title .teb").attr("class", "teb");
        });
    }

    function fillLM() {
        // 两面
        var types = ['大', '小', '单', '双', '合大', '合小', '合单', '合双', '尾大', '尾小', '大单', '小单', '大双', '小双'];
        var div = $(".lianmian");
        div.empty();
        for (var i in types) {
            add_bet_item('特' + types[i], "特" + types[i], div);
        }
        var types = ['天肖', '地肖', '前肖', '后肖', '家肖', '野肖'];
        for (var i in types) {
            add_bet_item('特' + types[i][0], "特" + types[i], div);
        }
        add_bet_item('和大', '总和大', div);
        add_bet_item('和小', '总和小', div);
        add_bet_item('和单', '总和单', div);
        add_bet_item('和双', '总和双', div);
    }

    function fillZhengMa() {
        // 正码
        var div = $(".zhengma1");
        div.empty();
        for (var i = 1; i <= 45; i++) {
            add_bet_item("正" + i, draw_number(i), div);
        }
        div = $(".zhengma2");
        div.empty();
        for (var i = 46; i <= 49; i++) {
            add_bet_item("正" + i, draw_number(i), div);
        }
    }

    function fillZhengMa16() {
        // 正码1-6
        var div = $(".six");
        div.empty();
        var arr = ['一', '二', '三', '四', '五', '六'];
        var arr2 = ['大', '小', '单', '双', '合大', '合小', '合单', '合双', '尾大', '尾小', '红', '蓝', '绿'];
        for (var z in arr) {
            add_bet_th("正码" + arr[z], div);
            var ul = $('<ul class="am-avg-sm-2 bet"></ul>');
            for (var i in arr2) {
                var name = arr2[i];
                if (name == '红') {
                    div.append(ul);
                    var ul = $('<ul class="am-avg-sm-3 bet"></ul>');
                }
                if (name == '红' || name == '蓝' || name == '绿') name += '波';
                add_bet_item(arr[z] + arr2[i], name, ul);
            }
            div.append(ul);
        }
    }
    
    function fillSeBo() {
        // 色波
        var div = $(".sebo");
        div.empty;
        add_bet_item('特红', '红波', div);
        add_bet_item('特蓝', '蓝波', div);
        add_bet_item('特绿', '绿波', div);

        var div = $(".qisebo");
        div.empty;
        add_bet_item('七红', '红波', div);
        add_bet_item('七蓝', '蓝波', div);
        add_bet_item('七绿', '绿波', div);
        add_bet_item('七和', '和局', div);

        // 红球
        var types = ['大', '小', '单', '双', '大单', '大双', '小单', '小双'];
        var div = $(".hongqiu");
        div.empty();
        for (var i in types) {
            add_bet_item('特红' + types[i], "红" + types[i], div);
        }

        // 蓝球
        var types = ['大', '小', '单', '双', '大单', '大双', '小单', '小双'];
        var div = $(".lanqiu");
        div.empty();
        for (var i in types) {
            add_bet_item('特蓝' + types[i], "蓝" + types[i], div);
        }

        // 绿球
        var types = ['大', '小', '单', '双', '大单', '大双', '小单', '小双'];
        var div = $(".lvqiu");
        div.empty();
        for (var i in types) {
            add_bet_item('特绿' + types[i], "绿" + types[i], div);
        }
    }

    function fillTouWeiShu() {
        // 头尾数
        var div = $(".toushu1");
        div.empty();
        for (var i = 0; i <= 1; i++) {
            add_bet_item('特头' + i, i + '头', div);
        }
        var div = $(".toushu2");
        div.empty();
        for (var i = 2; i <= 4; i++) {
            add_bet_item('特头' + i, i + '头', div);
        }

        var div = $(".weishu");
        div.empty();
        for (var i = 0; i <= 9; i++) {
            var li = add_bet_item('特尾' + i, i + '尾', div);

            var s2 = $('<span class="w-numbers"></span>');
            for (var k = 1; k <= 49; k++) {
                if (k % 10 == i) s2.append(draw_number(k));
            }
            li.append(s2);
        }
    }

    function fillZongXiao() {
        // 总肖
        var div = $(".zongxiao");
        div.empty();
        for (var i = 2; i <= 7; i++) {
            add_bet_item('总' + i, i + '肖', div);
        }
        add_bet_item('总单', '总肖单', div);
        add_bet_item('总双', '总肖双', div);
    }

    function fillYiXiao() {
        // 一肖
        var div = $(".yixiao");
        div.empty();
        var arr = ['鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'];
        for (var i in arr) {
            var li = add_bet_item('平特' + arr[i], arr[i], div);

            var s2 = $('<span class="w-numbers"></span>');
            var xiaos = gameRule.getXiaoNumbers(arr[i]);
            for (var k in xiaos) {
                s2.append(draw_number(xiaos[k]));
            }
            li.append(s2);
        }
    }

    function fillTeXiao() {
        // 特肖
        var arr = ['鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'];
        var div = $(".texiao");
        div.empty();
        for (var i in arr) {
            var li = add_bet_item('特' + arr[i], arr[i], div);

            var s2 = $('<span class="w-numbers"></span>');
            var xiaos = gameRule.getXiaoNumbers(arr[i]);
            for (var k in xiaos) {
                s2.append(draw_number(xiaos[k]));
            }
            li.append(s2);
        }
    }

    function fillZhengXiao() {
        // 正肖
        var arr = ['鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'];
        var div = $(".zhengxiao");
        div.empty();
        for (var i in arr) {
            var li = add_bet_item('正' + arr[i], arr[i], div);

            var s2 = $('<span class="w-numbers"></span>');
            var xiaos = gameRule.getXiaoNumbers(arr[i]);
            for (var k in xiaos) {
                s2.append(draw_number(xiaos[k]));
            }
            li.append(s2);
        }
    }

    function fillWuXing() {
        // 五行
        var div = $(".wuxing1");
        div.empty();
        add_bet_item('特金', '金', div);
        add_bet_item('特木', '木', div);
        add_bet_item('特水', '水', div);
        add_bet_item('特火', '火', div);
        var div = $(".wuxing2");
        div.empty();
        add_bet_item('特土', '土', div);
    }

    function draw_number(n) {
        var l = '<span class="round-3 __c__">__i__</span>';

        n = parseInt(n);
        var k = n < 10 ? '0' + n : n;
        var hong = gameRule.hongbo(), lan = gameRule.lanbo(), lv = gameRule.lvbo();
        var c = '';
        if (hong.indexOf(n) != -1) c = 'red';
        else if (lan.indexOf(n) != -1) c = 'blue';
        else if (lv.indexOf(n) != -1) c = 'green';
        l = l.replace(/__c__/g, c);
        l = l.replace(/__i__/g, k);
        return l;
    }

    function fill_zengte()
    {
        var f = function() {
            var type = $(".page5 .types .active").attr("value");
            var ul = $(".page5 .n1-45"); ul.empty();
            for (var i = 1; i <= 45; i++) {
                var k = i < 10 ? '0' + i : i;
                add_bet_item(type + '码' + k, draw_number(i), ul);
            }
            var ul = $(".page5 .n46-49"); ul.empty();
            for (var i = 46; i <= 49; i++) {
                add_bet_item(type + '码' + k, draw_number(i), ul);
            }

            var ul = $(".page5 .zt-lm"); ul.empty();
            var arr = ['大', '小', '单', '双', '合大', '合小', '合单', '合双', '尾大', '尾小'];
            for (var i in arr) {
                add_bet_item(type + arr[i], arr[i], ul);
            }

            var ul = $(".page5 .zt-boduan"); ul.empty();
            var arr = ['红', '蓝', '绿'];
            for (var i in arr) {
                add_bet_item(type + arr[i], arr[i] + '波', ul);
            }
        }
        f();

        var _drawBanner = function() {
            var type = $(".page5 .types .active").attr("value");
            $(".page5 .zt-title li").html("正" + type + "特");
            $(".page5 li").removeClass("bet-active");
        };
        $(".page5 .types li").click(function(e) {
            $(".page5 .types li").removeClass("active");
            $(e.currentTarget).addClass("active");
            _drawBanner();
            f();

            // 需要重新注册事件
            scan_bet_items($(".page5"));
        });
    }

    // 连码的处理
    function fill_lianma() {
        var ul = $(".page6 .n1-45"); ul.empty();
        for (var i = 1; i <= 45; i++) {
            ul.append('<li class="bet-item">' + draw_number(i) + 
            '<span class="rate"></span>' +
            '</div></li>');
        }
        var ul = $(".page6 .n46-49"); ul.empty();
        for (var i = 46; i <= 49; i++) {
            ul.append('<li class="bet-item">' + draw_number(i) + 
            '<span class="rate"></span>' +
            '</div></li>');
        }

        var _drawBanner = function() {
            var type = $(".page6 .types .active").attr("value");
            $(".page6 .lm-title li").html($(".page6 .types .active").html());
            $(".page6 li").removeClass("bet-active");
            refresh_bet_items();
        };
        $(".page6 .types li").click(function(e) {
            $(".page6 .types li").removeClass("active");
            $(e.currentTarget).addClass("active");
            _drawBanner();
        });
    }

    // 需要自己处理数字被点击
    var clickBetItemF = function(target) {
        var n = target.find("bet-content").html();
        if (target.attr("class") && target.attr("class").indexOf("bet-active") != -1) return;

        if ($(".page6").css("display") != 'none') {
            var item = $(".page6 .types .active");
            var min = parseInt(item.attr("min")), max = parseInt(item.attr("max"));
            if ($(".page6 .bet-active").length >= max) {
                alert2("不允许超过" + max + "个选项");
                return true;
            }
        }
        if ($(".page13").css("display") != 'none') {
            // 合肖
            var item = $(".page13 .hx .bet-active");
            if (item.length >= 11) {
                alert2("不允许超过11个选项");
                return true;
            }
        }
        if ($(".page17").css("display") != 'none') {
            // 不中
            var item = $(".page17 .buzhong .bet-active");
            if (item.length >= 12) {
                alert2("不允许超过12个选项");
                return true;
            }
        }

        // 走通用逻辑
        return;
    }

    // 取得注单列表
    var extraListF = function(data) {
        var v = $(".footer input").val().trim();
        try {
            v = parseInt(v);
        } catch (e) {}

        if ($(".page6").css("display") != 'none') {
            // 连码的处理
            var item = $(".page6 .types .active");
            var min = parseInt(item.attr("min"));
            var arr = $(".page6 .bet-active .round-3");
            if (arr.length < min) return data;

            var k = item.attr("value");
            var numbers = [];
            for (var i = 0; i < arr.length; i++) {
                numbers.push(parseInt($(arr[i]).html()));
            }
            data[k + ":" + numbers.join(",")] = v * 100;
            return data;
        }
        if ($(".page12").css("display") != 'none') {
            // 连肖的处理
            var item = $(".page12 .types .active");
            var min = parseInt(item.attr("min"));
            var arr = $(".page12 .bet-active .title");
            if (arr.length < min) return data;
            var list = [];
            for (var i = 0; i < arr.length; i++) list.push($(arr[i]).html());

            var limit = parseInt(item.attr("value"));
            var k = "连肖" + limit;
            var arr;
            if (limit == 2) arr = group2(list);
            else if (limit == 3) arr = group3(list);
            else if (limit == 4) arr = group4(list);
            else if (limit == 5) arr = group5(list);
            var data = {};
            for (var i in arr) {
                data[k + ":" + arr[i].join(",")] = v * 100;
            }
            return data;
        }
        if ($(".page14").css("display") != 'none') {
            // 连尾的处理
            var item = $(".page14 .types .active");
            var min = parseInt(item.attr("min"));
            var arr = $(".page14 .bet-active .title");
            if (arr.length < min) return data;
            var list = [];
            for (var i = 0; i < arr.length; i++) list.push($(arr[i]).html()[0]);

            var limit = parseInt(item.attr("value"));
            var k = "连尾" + limit;
            var arr;
            if (limit == 2) arr = group2(list);
            else if (limit == 3) arr = group3(list);
            else if (limit == 4) arr = group4(list);
            else if (limit == 5) arr = group5(list);
            var data = {};
            for (var i in arr) {
                data[k + ":" + arr[i].join(",")] = v * 100;
            }
            return data;
        }
        if ($(".page13").css("display") != 'none') {
            // 合肖
            data = {};
            var arr = $(".page13 .bet-active .title");

            // 刷新下赔率信息
            var key = "合" + arr.length;
            if (arr.length < 2) {
                $(".page13 .hx-title span").attr("key", "");
            }
            else {
                $(".page13 .hx-title span").attr("key", key);
            }
            refresh_bet_items();

            if (arr.length < 2) return data;
            var list = [];
            for (var i = 0; i < arr.length; i++) list.push($(arr[i]).html());
            data[key + ":" + list.join(",")] = v * 100;
            return data;
        }
        if ($(".page17").css("display") != 'none') {
            // 不中
            data = {};
            var arr = $(".page17 .bet-active .round-3");

            // 刷新下赔率信息
            var key = "不中" + arr.length;
            if (arr.length < 5) {
                $(".page17 .buzhong-title span").attr("key", "");
            }
            else {
                $(".page17 .buzhong-title span").attr("key", key);
            }
            refresh_bet_items();

            if (arr.length < 5) return data;
            var list = [];
            for (var i = 0; i < arr.length; i++) list.push(parseInt($(arr[i]).html()));
            data[key + ":" + list.join(",")] = v * 100;
            return data;
        }

        return data;
    }

    var parseTargetF = function(k) {
        var types = ['中3', '全3', '全2', '中2', '特串', '全4'];
        var arr = k.split(":");
        if (arr.length > 1 && types.indexOf(arr[0]) != -1) {
            var limit = 2;
            if (arr[0] != '特串') limit = parseInt(arr[0][1]);
            var list = arr[1].split(",");

            // 组数
            var betList = [];
            if (limit == 2) betList = group2(list);
            else if (limit == 3) betList = group3(list);
            else if (limit == 4) betList = group4(list);
            return gameRule.getTargetName(arr[0]) + " " + arr[1] + "[" + betList.length + "组]"
        }
        if (arr.length > 1 && arr[0].startsWith('不中')) {
            return "自选" + arr[0] + " - " + arr[1];
        }
        return gameRule.getTargetName(k);
    }

    // 需要自己处理下注的逻辑
    var calcBetListF = function(data) {
        var total = 0, count = 0;
        if ($(".page6").css("display") != 'none') {
            // 连码的处理
            var types = ['中3', '全3', '全2', '中2', '特串', '全4'];
            for (var k in data) {
                var arr = k.split(":");
                if (arr.length > 1 && types.indexOf(arr[0]) != -1) {
                    var list = arr[1].split(',');
                    var limit = 2;
                    if (arr[0] != '特串') limit = parseInt(arr[0][1]);

                    // 组数
                    var betList = [];
                    if (limit == 2) betList = group2(list);
                    else if (limit == 3) betList = group3(list);
                    else if (limit == 4) betList = group4(list);
                    count += betList.length;
                    total += data[k] * betList.length;
                    continue;
                }
                count++;
                total += data[k];
            }
            return [count, total/100];
        }
        if ($(".page12").css("display") != 'none' || $(".page14").css("display") != 'none') {
            for (var i in data) {
                count++;
                total += data[i] / 100;
            }
            return [total, count];
        }
        if ($(".page13").css("display") != 'none') {
            for (var i in data) {
                count++;
                total += data[i] / 100;
            }
            return [total, count];
        }
        if ($(".page17").css("display") != 'none') {
            for (var i in data) {
                count++;
                total += data[i] / 100;
            }
            return [total, count];
        }
    }

    var unpackF = function(data) {
        if ($(".page6").css("display") == 'none') return data;

        var r = {};
        var types = ['中3', '全3', '全2', '中2', '特串', '全4'];
        for (var k in data) {
            var arr = k.split(":");
            if (arr.length > 1 && types.indexOf(arr[0]) != -1) {
                var list = arr[1].split(',');
                var limit = 2;
                if (arr[0] != '特串') limit = parseInt(arr[0][1]);

                // 组数
                var betList = [];
                if (limit == 2) betList = group2(list);
                else if (limit == 3) betList = group3(list);
                else if (limit == 4) betList = group4(list);
                for (var i in betList) {
                    r[arr[0] + ':' + betList[i].join(",")] = data[k];
                }
                continue;
            }
            else
                r[k] = data[k];
        }
        return r;
    }

    // 连肖的处理
    function fill_lianxiao() {
        var f = function() {
            var type = "连肖" + $(".page12 .types .active").attr("value");

            var ul = $(".page12 .lx"); ul.empty();
            var arr = ['鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'];
            for (var i in arr) {
                var li = add_bet_item(type + arr[i], arr[i], ul);
                
                // 填充12生肖的数字
                var numbers = gameRule.getXiaoNumbers(arr[i]);
                var s2 = $('<span class="w-numbers"></span>');
                for (var k in numbers) {
                    s2.append(draw_number(numbers[k]));
                }
                li.append(s2);
            }
        }
        f();

        var _drawBanner = function() {
            var type = $(".page12 .types .active").attr("value");
            $(".page12 .lm-title li").html($(".page12 .types .active").html());
            $(".page12 li").removeClass("bet-active");
        };
        $(".page12 .types li").click(function(e) {
            $(".page12 .types li").removeClass("active");
            $(e.currentTarget).addClass("active");
            _drawBanner();
            f();
            refresh_bet_items();
            $(".lx-title li").html($(e.currentTarget).html());

            // 重新注册下点击事件
            scan_bet_items($(".page12"));
        });
    }

    // 连尾的处理
    function fill_lianwei() {
        var f = function() {
            var type = "连尾" + $(".page14 .types .active").attr("value");

            var ul = $(".page14 .lx"); ul.empty();
            for (var i = 0; i <= 9; i++) {
                var li = add_bet_item(type + i, i + "尾", ul);
                
                var s2 = $('<span class="w-numbers"></span>');
                for (var k = 1; k <= 49; k++) {
                    if (k % 10 == i) s2.append(draw_number(k));
                }
                li.append(s2);
            }
        }
        f();

        var _drawBanner = function() {
            var type = $(".page14 .types .active").attr("value");
            $(".page14 .lx-title li").html($(".page14 .types .active").html());
            $(".page14 li").removeClass("bet-active");
        };
        $(".page14 .types li").click(function(e) {
            $(".page14 .types li").removeClass("active");
            $(e.currentTarget).addClass("active");
            _drawBanner();
            f();
            refresh_bet_items();

            // 重新注册下点击事件
            scan_bet_items($(".page14"));
        });
    }

    // 合肖的处理
    function fill_hexiao() {
        var ul = $(".page13 .hx"); ul.empty();
        var arr = ['鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'];
        for (var i in arr) {
            var li = $('<li class="bet-item"></li>');
            li.append('<span class="title">' + arr[i] + '</span>');
            
            // 填充12生肖的数字
            var numbers = gameRule.getXiaoNumbers(arr[i]);
            var s2 = $('<span class="w-numbers"></span>');
            for (var k in numbers) {
                s2.append(draw_number(numbers[k]));
            }
            li.append(s2);
            ul.append(li);
        }
    }

    // 不中的处理
    function fill_buzhong() {
        var ul = $(".page17 .buzhong1"); ul.empty();
        for (var i = 1; i <= 45; i++) {
            var li = $('<li class="bet-item"></li>');
            li.append('<span class="title">' + draw_number(i) + '</span>');
            ul.append(li);
        }
        var ul = $(".page17 .buzhong2"); ul.empty();
        for (var i = 46; i <= 49; i++) {
            var li = $('<li class="bet-item"></li>');
            li.append('<span class="title">' + draw_number(i) + '</span>');
            ul.append(li);
        }
    }

    // 额外的赔率刷新逻辑
    var extraRateF = function() {
        var type = $(".page6 .types .active").attr("value");
        if (type == '中3') {
            var rate = gameRule.map[type] ? gameRule.map[type].rate : "";
            type = '三中三';
            var rate2 = gameRule.map[type] ? gameRule.map[type].rate : "";
            $(".page6 .n1-45 .rate").html(rate + "/" + rate2);
            $(".page6 .n46-49 .rate").html(rate + "/" + rate2);
            return;
        }
        if (type == '中2') {
            var rate = gameRule.map[type] ? gameRule.map[type].rate : "";
            type = '二中特';
            var rate2 = gameRule.map[type] ? gameRule.map[type].rate : "";
            $(".page6 .n1-45 .rate").html(rate + "/" + rate2);
            $(".page6 .n46-49 .rate").html(rate + "/" + rate2);
            return;
        }
        var rate = gameRule.map[type] ? gameRule.map[type].rate : "";
        $(".page6 .n1-45 .rate").html(rate);
        $(".page6 .n46-49 .rate").html(rate);
    }

    // 自定义的开奖结果绘制
    var drawF = function(i, index) {
        var l = draw_number(i);
        if (parseInt(index) < 6) return l;
        return "<span class='plus'>+</span>" + l;
    }

    // 滚动
    var switchTabF = function() {
        new IScroll(".page5 .banner", {
            scrollX: true,
            scrollY: false,
            click: true,
        });
        new IScroll(".page6 .banner", {
            scrollX: true,
            scrollY: false,
            click: true,
        });
        new IScroll(".page12 .banner", {
            scrollX: true,
            scrollY: false,
            click: true,
        });
        new IScroll(".page14 .banner", {
            scrollX: true,
            scrollY: false,
            click: true,
        });
    };

    var initF = function(game, first) {
        window.game = game;
        initGame(game, function() {
            if (first !== false) 
                fill_tabs(['特码', '两面', '正码', '正码1-6', '正特', "连码", "色波", "头尾数", "总肖", "一肖", "特肖", "连肖",
                    "合肖", "连尾", "正肖", "五行", "自选不中"]);
            currTabId = parseInt($(".menu-left a.active").attr("value"));
            $(".page" + currTabId).attr("flag", 1);
            var f = tabDraws[currTabId - 1];
            f();
        }, first);
    }

    var data = {
        drawResult: drawF,
        init: initF,
        switchTab: switchTabF,
        clickBetItem: clickBetItemF,
        extraList: extraListF,
        parseTarget: parseTargetF,
        calcBetList: calcBetListF,
        unpack: unpackF,
        extraRate: extraRateF,
    }
    context.global.game["lhc"] = data;
})();